#pragma once

#include <unordered_map>
#include <unordered_set>
#include <vector>

#include "irfunction.h"

class DomTree {
  public:
    std::vector<IRBlock*> nodes;
    std::unordered_map<IRBlock*, std::vector<IRBlock*>> dom;
    std::unordered_map<IRBlock*, IRBlock*> idom;
    std::unordered_map<IRBlock*, std::unordered_set<IRBlock*>> DF;

    void Build(IRBlock* entry, bool reverse = false);
};